<!-- 单据数量汇总报表 documentQuantitySummary-->
<template>
   <div class="app-container">
      <el-form label-width="100px" :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
         <el-form-item label="经销商编号" prop="disCode">
            <el-input
               v-model="queryParams.disCode"
               placeholder="请输入经销商编号"
               clearable
               style="width: 240px"
               @keyup.enter.native="handleQuery"
            />
         </el-form-item>
         <el-form-item label="单据日期">
            <el-date-picker v-model="dateRange" style="width: 340px" value-format="yyyy-MM-dd HH:mm:ss"
               type="datetimerange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
               :default-time="['00:00:00', '23:59:59']"></el-date-picker>
         </el-form-item>
         <el-form-item>
            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
         </el-form-item>
      </el-form>

      <el-table border v-loading="loading" :data="billList" max-height="700">
         <el-table-column label="序号" fixed type="index" width="55" align="center" />
         <el-table-column label="经销商编号" prop="code" width="150"/>
         <el-table-column label="经销商名称" prop="name" width="300"/>
         <el-table-column label="销售订单数量" prop="sellOrderBillQty" sortable :sort-method="(a,b)=>{return a.sellOrderBillQty - b.sellOrderBillQty}" />
         <el-table-column label="销售出库单单数量" prop="sellOutBillQty" sortable :sort-method="(a,b)=>{return a.sellOutBillQty - b.sellOutBillQty}" />
         <el-table-column label="销售退货单单数量" prop="sellReturnBillQty" sortable :sort-method="(a,b)=>{return a.sellReturnBillQty - b.sellReturnBillQty}" />
         <el-table-column label="采购订单数量" prop="purchaseOrderBillQty" sortable :sort-method="(a,b)=>{return a.purchaseOrderBillQty - b.purchaseOrderBillQty}" />
         <el-table-column label="采购入库单数量" prop="purchaseInBillQty" sortable :sort-method="(a,b)=>{return a.purchaseInBillQty - b.purchaseInBillQty}" />
         <el-table-column label="采购退货单数量" prop="purchaseReturnBillQty" sortable :sort-method="(a,b)=>{return a.purchaseReturnBillQty - b.purchaseReturnBillQty}" />
      </el-table>
   </div>
</template>

<script>
   import {
      hqCommodityPage,

   } from "@/api/bill/documentQuantitySummary";
   export default {
      name: 'documentQuantitySummary',
      data() {
         return{
            showSearch: true,
            dateRange: [],
            queryParams:{
               disCode: undefined
            },
            loading: false,
            billList: []
         }
      },
      methods:{
         getList() {
            this.loading = true;
            // addRole(this.form).then(response => {})
            hqCommodityPage(this.addDateRange2(this.queryParams, this.dateRange, ['startTime', 'endTime'])).then(response => {
               console.log('list', response);
               this.billList = response.data;
               
               this.loading = false;
            }
            );
         },
         handleQuery() {
            this.getList();
         },
         resetQuery(){
            this.dateRange = [];
            this.resetForm("queryForm");
            this.getList();

         }
      },
      mounted(){
         
      },
      created(){
         this.getList();
      }
   ,}
</script>